package com.alex.seo.domain.log;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.alex.seo.dao.Identifieble;
import com.alex.seo.service.logging.LogType;

@Entity
@Table(name = "log")
public class Log implements Identifieble<Integer> {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;

	@Column
	@Temporal(TemporalType.TIMESTAMP)
	private Date date;

	@Column
	@Enumerated(value = EnumType.STRING)
	private LogType type;

	@Column(columnDefinition = "TEXT")
	private String message;

	public Log(LogType type, String message) {
		this.type = type;
		this.message = message;
		this.date = new Date();
	}

	@Override
	public Integer getId() {
		return id;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public LogType getType() {
		return type;
	}

	public void setType(LogType type) {
		this.type = type;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
}
